{/* LAYOUT模板 */}
<layout name="layout"/>
{/* LAYOUT模板 */}

{/* CSS,JS*/}
<css href="__PUBLIC__/plugs/uploadify/uploadify.css"/>
<js href="__PUBLIC__/plugs/uploadify/jquery.uploadify.js"/>

<js href="__PUBLIC__/plugs/layui-v2.2.5/layui.js"/>
<js href="__PUBLIC__/plugs/layer-v3.1.1/layer.js"/>
<js href="__PUBLIC__/plugs/laydate-v5.0.9/laydate.js"/>

{/* CSS,JS*/}

<include file="Template:position"/>

<style type="text/css">
	#addadverse-dom table tr th{text-align: right;color:#606060;}
</style>

<div id="addadverse-dom" class="panel panel-default">
	<table class="table">
        <tr>
          	<th scope="row" width="150px" style="text-align: right;">上传图片：</th>
          	<td>
          		<div class="form-group">
				    <form>
						<!--<div id="queue"></div>-->
						<input id="file_upload" name="img_gallery" type="file" multiple="true">
						<input id="url" type="hidden" value="__PUBLIC__/Upload/images/">
						<div id="img_panel">				
							<img src="__PUBLIC__/image/admin/empty.png" width="300px" no-img-src="__PUBLIC__/image/admin/empty.png"/>
						</div>
					</form>
				</div>
          	</td>
          	<td>
          		<span class="label label-danger">(必填)</span>
          		<div style="color:#ADADAD;font-size: 12px;">
          			图片规格大小:宽度和高度(1920px * 680px)
          		</div>
          	</td>
        </tr>
        <tr>
          	<th scope="row">图片名称：</th>
          	<td>
          		<div class="form-group">
				    <input type="text" class="form-control" id="name" placeholder="图片名称">
			 	</div>
          	</td>
          	<td>
          		<span class="label label-danger">(必填)</span>
          	</td>
        </tr>
        <tr>
          	<th scope="row">开始时间：</th>
          	<td>
          		<div class="form-group">
          			<input type="text" class="layui-input form-control" id="test-limit1" placeholder="年-月-日">
			 	</div>
          	</td>
          	<td>
          		<span class="label label-info">(选填)</span>
          	</td>
        </tr>
        <tr>
          	<th scope="row">结束时间：</th>
          	<td>
          		<div class="form-group">
				    <input type="text" class="layui-input form-control" id="test-limit1" placeholder="年-月-日">
			 	</div>
          	</td>
          	<td>
          		<span class="label label-info">(选填)</span>
          	</td>
        </tr>
        <tr>
          	<th scope="row">媒介类型：</th>
          	<td>
          		<div class="form-group">
				    
          			<select name=""  class="form-control">
          				<option value="" selected="true">图片</option>
          				<option value="">视频</option>
          			</select>
			 	</div>
          	</td>
          	<td>
          		<span class="label label-danger">(必填)</span>
          	</td>
        </tr>
        <tr>
          	<th scope="row">相关页面链接：</th>
          	<td>
          		<div class="form-group">
				    <input type="text" class="form-control" id="name" placeholder="http://">
			 	</div>
          	</td>
          	<td>
          		<span class="label label-danger">(必填)</span>
          	</td>
        </tr>
        <tr>
          	<td colspan="3">
				<div style="text-align: center;">
					<button type="button" class="btn btn-default">提交</button>
					<a href="javascript:location.reload();" class="btn btn-primary">重置</a>
				</div>
          	</td>
        </tr>
    </table>
</div>

<script type="text/javascript">
	
	
	$('#file_upload').uploadify({
		swf      : '__PUBLIC__/plugs/uploadify/uploadify.swf',
		uploader : '{:U("goods/add_goods_gallery")}',
		buttonText: '点击上传图片',
		onUploadStart:function(file){
//			$('#loading').QLoading({text:'上传中...'});	
		},
		onUploadSuccess:function(file, data, response){
			var url	=	document.getElementById('url').value;
			data 	= 	jQuery.parseJSON(data); 
			if(data.status == "1"){
				showImg(url + data.thumb_url,data.id);
//				$('#loading').QLoading({text:'上传成功',img:'happy',status:'close',time:0.5});	
			}else{
//				$('#loading').QLoading({text:'上传失败',img:'sad',status:'close',time:1.5});	
			}
		}
	});
	
	// 显示图片
	function showImg(url,id){
		var img_table 	= 	$('#img_panel');
		var img			=	document.createElement('img');
		
		// img
		img.style.width = '400px';
		img.setAttribute('src',url);
		
		img_table.html($(img));
	}
	
	// 时间选择Plugin
	layui.use('laydate', function(){
	  	var laydate = layui.laydate;
	  
	  	var ins22 = laydate.render({
	    	elem: '#test-limit1'
	    	,min: '2016-10-14'
	    	,max: '2080-10-14'
	    	,ready: function(){
	      		ins22.hint('日期可选值设定在 <br> 2016-10-14 到 2080-10-14');
	    	}
	  	});
	});
</script>

